layui.use(['element','laypage', 'layer'], function(){
    var element = layui.element;
    var laypage = layui.laypage
        ,layer = layui.layer;


});


$(function () {

    /**
     * 导航栏菜单高亮显示
     */

    var typeId = $("#type").val();
    $("#menu"+typeId+"").css("color","#45B6F7");
    $("#menu"+typeId+"").addClass("layui-this");

    initLayPage();

})

/**
 * 查看文章详情页面
 * @param id
 */
function  desc(typeid,id) {
    location.href = "/article/"+id;
}



function initLayPage(pageConf) {
    if(!pageConf){
        pageConf = {};
        pageConf.limit = 10;
        pageConf.page = 1;
    }

    var typeId = $("#rel_typeId").val();

    layui.use(['element','laypage', 'layer'], function(){
                var element = layui.element;
                var laypage = layui.laypage
                    ,layer = layui.layer;

                var pageData = $("#pageData").val();
                var page = JSON.parse(pageData);

                laypage.render({
                    elem: 'page'
                    ,count: page.count
                    ,curr:page.page
                    ,limit:page.limit
                    ,theme: '#1E9FFF'
                    ,jump:function (obj,first) {
                        //首次不执行
                        if(!first){
                            location.href = "/longtime?page="+obj.curr+"&limit="+obj.limit;
                        }
                    }
                });
            });
}


